package entity

type CustomCmdConfig struct {
	CmdName string `yaml:"cmd_name"`
	Task    string `yaml:"task"`
}

func (r *CustomCmdConfig) AllEmpty() bool {
	return r.CmdName == "" && r.Task == ""
}

func (r *CustomCmdConfig) Compare(obj FieldInterface) FieldInterface {
	localConfig, ok := obj.(*CustomCmdConfig)
	if !ok || localConfig == nil || localConfig.AllEmpty() {
		return r
	}

	if localConfig.CmdName == "" {
		localConfig.CmdName = r.CmdName
	}

	if localConfig.Task == "" {
		localConfig.Task = r.Task
	}

	return localConfig
}
